﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using Commonality.DAL.MySQL;

namespace WZS_Auto_Classify_Windows_Service
{
    public partial class WZSAutoClassify : ServiceBase
    {
        System.Timers.Timer ServiceTime;
        public WZSAutoClassify()
        {
            InitializeComponent();
            InitService();
        }

        protected override void OnStart(string[] args)
        {
            ServiceStart();
        }

        protected override void OnStop()
        {
            ServiceStop();
        }
        #region 服务启动停止初始化方法
        private void InitService()
        {
            MySqlFunction.InitMySQLFunction();
            MySqlFunction.MySql.DataSource = "127.0.0.1";
            MySqlFunction.MySql.Password = "liebeskind";
            MySqlFunction.MySql.UserId = "root";


            ServiceTime = new System.Timers.Timer();
            ServiceTime.Elapsed += new System.Timers.ElapsedEventHandler(ServiceTimeElapsed);
            ServiceTime.Interval = 5000;
            ServiceTime.AutoReset = true;
        }
        private void ServiceStart()
        {
            ServiceTime.Enabled = true;
            ServiceTime.Start();
        }
        private void ServiceTimeElapsed(object sender, EventArgs e)
        {

        }
        private void ServiceStop()
        {
            ServiceTime.Stop();
        }
        #endregion
        #region 服务方法
        private void MySQLInputStatisticsTableInsert()
        {

            //MySqlFunction.InputStatistics.InputStatistics_INSERT(1);        
        }
        #endregion
    }
}
